
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>2.5 自动备灾(Automatic Failover) · 大数据 HA 课堂笔记</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content=" 李振超">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-page-toc-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism-base16-ateliersulphurpool.light.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-change_girls/girls.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../styles/website.css">
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="26-wen-da.html" />
    
    
    <link rel="prev" href="24-ha-hdfs-ji-qun-guan-li-ming-ling.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="http://www.atguigu.com/" target="_blank" class="custom-link">联系我们</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    第 1 章 HA概述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../chapter1.html">
            
                <a href="../chapter1.html">
            
                    
                    第 2 章 HDFS HA
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="21-bei-jing.html">
            
                <a href="21-bei-jing.html">
            
                    
                    2.1 背景
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="22-jia-gou.html">
            
                <a href="22-jia-gou.html">
            
                    
                    2.2 架构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="23-bu-shu.html">
            
                <a href="23-bu-shu.html">
            
                    
                    2.3 HDFS HA 部署
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="24-ha-hdfs-ji-qun-guan-li-ming-ling.html">
            
                <a href="24-ha-hdfs-ji-qun-guan-li-ming-ling.html">
            
                    
                    2.4 HA HDFS 集群管理命令
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2.5" data-path="24-zi-dong-bei-707e28-automatic-failover.html">
            
                <a href="24-zi-dong-bei-707e28-automatic-failover.html">
            
                    
                    2.5 自动备灾(Automatic Failover)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="26-wen-da.html">
            
                <a href="26-wen-da.html">
            
                    
                    2.6 自动备灾常见问题
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../di-3-zhang-yarn-resourcemange-ha.html">
            
                <a href="../di-3-zhang-yarn-resourcemange-ha.html">
            
                    
                    第 3 章 Yarn ResourceMange HA
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >2.5 自动备灾(Automatic Failover)</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="25-&#x81EA;&#x52A8;&#x5907;&#x707E;auto-failover">2.5 &#x81EA;&#x52A8;&#x5907;&#x707E;(Auto Failover)</h1>
<h2 id="251-&#x4ECB;&#x7ECD;">2.5.1 &#x4ECB;&#x7ECD;</h2>
<p>&#x81EA;&#x52A8;&#x5907;&#x707E;&#x4E5F;&#x53EB;&#x81EA;&#x52A8;&#x6545;&#x969C;&#x8F6C;&#x79FB;.</p>
<p>&#x524D;&#x9762;&#x5B66;&#x4E60;&#x4E86;&#x5982;&#x4F55;&#x914D;&#x7F6E;&#x624B;&#x52A8;&#x7684;&#x5907;&#x707E;. &#x5728;&#x8FD9;&#x79CD;&#x6A21;&#x5F0F;&#x4E0B;, &#x5373;&#x4F7F; Active NameNode &#x6302;&#x4E86;, &#x7CFB;&#x7EDF;&#x4E5F;&#x4E0D;&#x4F1A;&#x81EA;&#x52A8;&#x89E6;&#x53D1;&#x4ECE; Active NameNode &#x5230; Standby NameNode &#x7684;&#x5907;&#x707E;.</p>
<p>&#x4E0B;&#x9762;&#x6211;&#x4EEC;&#x5F00;&#x59CB;&#x5B66;&#x4E60;&#x5982;&#x4F55;&#x914D;&#x7F6E;&#x548C;&#x90E8;&#x7F72;&#x81EA;&#x52A8;&#x5907;&#x707E;.</p>
<hr>
<h2 id="252-&#x81EA;&#x52A8;&#x5907;&#x707E;&#x9700;&#x8981;&#x7528;&#x5230;&#x7684;&#x7EC4;&#x4EF6;component">2.5.2 &#x81EA;&#x52A8;&#x5907;&#x707E;&#x9700;&#x8981;&#x7528;&#x5230;&#x7684;&#x7EC4;&#x4EF6;(Component)</h2>
<p>&#x81EA;&#x52A8;&#x5907;&#x707E;&#x9700;&#x8981;&#x7ED9; HDFS &#x518D;&#x589E;&#x52A0; 2 &#x4E2A;&#x65B0;&#x7684;&#x7EC4;&#x4EF6;:</p>
<ul>
<li>&#x4E00;&#x4E2A; Zookeeper quorum (Zookeeper &#x4EF2;&#x88C1;)</li>
<li><p>ZKFailoverController process (ZKFC, Zookeeper &#x5907;&#x707E;&#x63A7;&#x5236;&#x7ECF;&#x5E38;)</p>
<p>Zookeeper &#x662F;&#x4E00;&#x4E2A;&#x9AD8;&#x53EF;&#x7528;&#x670D;&#x52A1;, &#x7528;&#x6765;&#x7EF4;&#x6301;&#x5C11;&#x91CF;&#x7684;&#x534F;&#x8C03;&#x6570;&#x636E;, &#x6570;&#x636E;&#x53D8;&#x5316;&#x7684;&#x65F6;&#x5019;&#x901A;&#x77E5;&#x5BA2;&#x6237;&#x7AEF;, &#x548C;&#x76D1;&#x542C;&#x5BA2;&#x6237;&#x7AEF;&#x7684;&#x5931;&#x6548;.</p>
</li>
</ul>
<h3 id="zookeeper-&#x4EF2;&#x88C1;">Zookeeper &#x4EF2;&#x88C1;</h3>
<p>&#x81EA;&#x52A8; HDFS failover &#x4F9D;&#x8D56;&#x4E8E; Zookeeper, &#x4E3B;&#x8981;&#x6709;&#x4EE5;&#x4E0B; 2 &#x4E2A;&#x539F;&#x56E0;:</p>
<ul>
<li><p>&#x5931;&#x6548;&#x68C0;&#x6D4B;(Failure detection)</p>
<p> &#x96C6;&#x7FA4;&#x4E2D;&#x7684;&#x6BCF;&#x4E00;&#x4E2A; NameNode &#x8282;&#x70B9;&#x90FD;&#x4F1A;&#x4E0E; Zookeeper &#x670D;&#x52A1;&#x5668;&#x4FDD;&#x6301;&#x4E00;&#x4E2A;&#x6301;&#x4E45;&#x7684;&#x4F1A;&#x8BDD;. &#x5982;&#x679C;&#x8BBE;&#x5907;&#x5D29;&#x6E83;, Zookeeper &#x4F1A;&#x8BDD;&#x5C06;&#x4F1A;&#x5931;&#x6548;, &#x7136;&#x540E;&#x901A;&#x77E5;&#x5176;&#x4ED6;&#x7684; NameNode: &#x89E6;&#x53D1;&#x5907;&#x707E;.</p>
</li>
<li><p>&#x6D3B;&#x52A8; NameNode &#x9009;&#x4E3E;(Active NameNode election)</p>
<p>Zookeeper &#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x4E2A;&#x7B80;&#x5355;&#x7684;&#x673A;&#x5236;&#x53BB;&#x9009;&#x4E3E;&#x4E00;&#x4E2A;&#x6D3B;&#x52A8;&#x8282;&#x70B9;.  &#x5982;&#x679C;&#x5F53;&#x524D;&#x5F53;&#x524D;&#x7684;&#x6D3B;&#x52A8; NameNode &#x6302;&#x4E86;, &#x53E6;&#x5916;&#x4E00;&#x4E2A;&#x8282;&#x70B9;&#x4F1A;&#x5F97;&#x5230;&#x4E00;&#x4E2A; Zookeeper &#x4E2D;&#x7684;&#x6392;&#x4ED6;&#x6027;&#x7684;&#x9501;, &#x4ECE;&#x800C;&#x8868;&#x660E;&#x8FD9;&#x4E2A;&#x8282;&#x70B9;&#x5E94;&#x8BE5;&#x53D8;&#x6210;&#x4E0B;&#x4E00;&#x4E2A;&#x6D3B;&#x52A8;&#x7684;&#x8282;&#x70B9;.</p>
</li>
</ul>
<hr>
<h3 id="zkfailovercontroller-zkfc">ZKFailoverController (ZKFC)</h3>
<p>ZKFC &#x662F;&#x4E00;&#x4E2A;&#x65B0;&#x7684;&#x7EC4;&#x4EF6;, &#x5B83;&#x662F;&#x4E00;&#x4E2A; Zookeeper &#x5BA2;&#x6237;&#x7AEF;, &#x4E5F;&#x662F;&#x7528;&#x6765;&#x76D1;&#x89C6;&#x548C;&#x7BA1;&#x7406; NameNode &#x7684;&#x72B6;&#x6001;. </p>
<p>&#x6BCF;&#x4E2A;&#x8FD0;&#x884C; NameNode &#x7684;&#x8BBE;&#x5907;&#x4E5F;&#x4F1A;&#x8FD0;&#x884C;&#x4E00;&#x4E2A; ZKFC.</p>
<p>ZKFC &#x8D1F;&#x8D23;&#x4E0B;&#x9762;&#x7684;&#x4E8B;&#x60C5;:</p>
<ul>
<li><p>&#x5065;&#x5EB7;&#x76D1;&#x6D4B;(Health monitoring)</p>
<p>ZKFC &#x4F1A;&#x5468;&#x671F;&#x6027;&#x7684;&#x8FDE;&#x63A5;&#x672C;&#x5730;&#x7684; NameNode, &#x5E76;&#x8FD0;&#x884C;&#x4E00;&#x4E2A;&#x5065;&#x5EB7;&#x76D1;&#x6D4B;&#x547D;&#x4EE4;.</p>
<p>&#x53EA;&#x8981; NameNode &#x53CA;&#x65F6;&#x7684;&#x54CD;&#x5E94;&#x4E00;&#x4E2A;&#x5065;&#x5EB7;&#x7684;&#x72B6;&#x6001;, ZKFC &#x5C31;&#x8BA4;&#x4E3A;&#x8282;&#x70B9;&#x662F;&#x5065;&#x5EB7;&#x7684;.</p>
<p>&#x5982;&#x679C;&#x8282;&#x70B9;&#x6302;&#x4E86;, &#x88AB;&#x51BB;&#x7ED3;&#x4E86;, &#x6216;&#x8005;&#x5176;&#x4ED6;&#x539F;&#x56E0;&#x8FDB;&#x5165;&#x4E86;&#x4E00;&#x4E2A;&#x4E0D;&#x5065;&#x5EB7;&#x72B6;&#x6001;, &#x5065;&#x5EB7;&#x76D1;&#x89C6;&#x5668;&#x4F1A;&#x628A;&#x8FD9;&#x8282;&#x70B9;&#x6807;&#x8BB0;&#x4E3A;&#x4E0D;&#x5065;&#x5EB7;(unhealthy)</p>
</li>
<li><p>Zookeeper &#x4F1A;&#x8BDD;&#x7BA1;&#x7406;</p>
<p>&#x5982;&#x679C;&#x672C;&#x5730;&#x7684; NameNode &#x662F;&#x5065;&#x5EB7;&#x7684;, ZKFC &#x5C31;&#x4F1A;&#x4FDD;&#x6301;&#x4E0E; Zookeeper &#x670D;&#x52A1;&#x7684;&#x4E00;&#x4E2A;&#x5F00;&#x7740;&#x7684;&#x4F1A;&#x8BDD;. &#x5982;&#x679C;&#x672C;&#x5730; NameNode &#x662F;&#x6D3B;&#x52A8;&#x7684;, &#x5B83;&#x4E5F;&#x4F1A;&#x6301;&#x6709;&#x4E00;&#x4E2A;&#x7279;&#x6B8A;&#x7684; lock znode. </p>
<p>&#x8FD9;&#x4E2A;&#x9501;&#x4F7F;&#x7528; Zookeeper &#x7684;&#x76EE;&#x7684;&#x662F;&#x4E34;&#x65F6;&#x8282;&#x70B9;(ephemeral node). &#x5982;&#x679C;&#x4F1A;&#x8BDD;&#x8FC7;&#x671F;, lock node &#x5C06;&#x4F1A;&#x81EA;&#x52A8;&#x88AB;&#x5220;&#x9664;.</p>
</li>
<li><p>&#x57FA;&#x4E8E; Zookeeper &#x7684;&#x9009;&#x4E3E;</p>
<p>&#x5982;&#x679C;&#x672C;&#x5730;&#x8282;&#x70B9;&#x662F;&#x5065;&#x5EB7;&#x7684;&#x5E76;&#x4E14; ZKFC &#x6CA1;&#x6709;&#x53D1;&#x73B0;&#x6CA1;&#x6709;&#x5176;&#x4ED6;&#x8282;&#x70B9;&#x6301;&#x6709; lock znode, &#x5B83;&#x5C06;&#x4F1A;&#x8BD5;&#x7740;&#x8BA9;&#x81EA;&#x5DF1;&#x53BB;&#x83B7;&#x5F97;&#x9501;.  &#x5982;&#x679C;&#x6210;&#x529F;, &#x90A3;&#x4E48;&#x5B83;&#x5C31;&#x8D62;&#x5F97;&#x4E86;&#x9009;&#x4E3E;, &#x7136;&#x540E;&#x8D1F;&#x8D23;&#x53BB;&#x8FD0;&#x884C;&#x4E00;&#x4E2A;&#x5907;&#x707E;&#x4F7F;&#x672C;&#x5730;&#x7684; NameNode &#x79F0;&#x4E3A;&#x6D3B;&#x52A8;&#x7684;.</p>
<p>&#x5907;&#x707E;&#x8FDB;&#x7A0B;&#x548C;&#x624B;&#x52A8;&#x5907;&#x707E;&#x57FA;&#x672C;&#x7C7B;&#x4F3C;. &#x5982;&#x679C;&#x5FC5;&#x8981;, &#x5148;&#x8FD0;&#x884C; fence, &#x7136;&#x540E;&#x672C;&#x5730; NameNode &#x53D8;&#x6210;&#x6D3B;&#x52A8;&#x72B6;&#x6001;.</p>
</li>
</ul>
<hr>
<h2 id="253-&#x90E8;&#x7F72;-zookeeper">2.5.3 &#x90E8;&#x7F72; Zookeeper</h2>
<p>&#x5206;&#x522B;&#x5728; hadoop201, hadoop202, hadoop203 &#x90E8;&#x7F72; Zookeeper.</p>
<p>&#x5177;&#x4F53;&#x64CD;&#x4F5C;&#x53C2;&#x8003;&#x524D;&#x9762;&#x7684; Zookeeper &#x7684;&#x5B66;&#x4E60;.</p>
<hr>
<h2 id="254-&#x914D;&#x7F6E;&#x81EA;&#x52A8;&#x5907;&#x707E;">2.5.4 &#x914D;&#x7F6E;&#x81EA;&#x52A8;&#x5907;&#x707E;</h2>
<p>&#x9996;&#x5148;&#x5173;&#x95ED;&#x5DF2;&#x7ECF;&#x8FD0;&#x884C;&#x7684;&#x96C6;&#x7FA4;.  &#x5F53;&#x96C6;&#x7FA4;&#x6B63;&#x5728;&#x8FD0;&#x884C;&#x7684;&#x65F6;&#x5019;, &#x662F;&#x4E0D;&#x53EF;&#x80FD;&#x4ECE;&#x624B;&#x52A8;&#x5907;&#x707E;&#x8F6C;&#x53D8;&#x6210;&#x81EA;&#x52A8;&#x5907;&#x707E;&#x7684;.</p>
<p><img src="http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/1539918563.png-atguiguText" alt=""></p>
<h3 id="&#x5728;hdfs-sitexml-&#x589E;&#x52A0;&#x4E00;&#x4E2A;&#x914D;&#x7F6E;">&#x5728;<code>hdfs-site.xml</code> &#x589E;&#x52A0;&#x4E00;&#x4E2A;&#x914D;&#x7F6E;</h3>
<p>&#x6307;&#x5B9A;&#x96C6;&#x7FA4;&#x88AB;&#x8BBE;&#x7F6E;&#x4E3A;&#x81EA;&#x52A8;&#x5907;&#x707E;.</p>
<pre class="language-"><code class="lang-xml"> <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>property</span><span class="token punctuation">&gt;</span></span>
   <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>name</span><span class="token punctuation">&gt;</span></span>dfs.ha.automatic-failover.enabled<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>name</span><span class="token punctuation">&gt;</span></span>
   <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>value</span><span class="token punctuation">&gt;</span></span>true<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>value</span><span class="token punctuation">&gt;</span></span>
 <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>property</span><span class="token punctuation">&gt;</span></span>
</code></pre>
<h3 id="&#x5728;core-sitexml-&#x589E;&#x52A0;&#x4E00;&#x4E2A;&#x914D;&#x7F6E;">&#x5728;<code>core-site.xml</code> &#x589E;&#x52A0;&#x4E00;&#x4E2A;&#x914D;&#x7F6E;</h3>
<p>&#x6307;&#x5B9A;&#x8FD0;&#x884C; Zookeeper &#x670D;&#x52A1;&#x7684;&#x4E3B;&#x673A;&#x548C;&#x7AEF;&#x53E3;</p>
<pre class="language-"><code class="lang-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>property</span><span class="token punctuation">&gt;</span></span>
 <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>name</span><span class="token punctuation">&gt;</span></span>ha.zookeeper.quorum<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>name</span><span class="token punctuation">&gt;</span></span>
 <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>value</span><span class="token punctuation">&gt;</span></span>hadoop201:2181,hadoop202:2181,hadoop203:2181<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>value</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>property</span><span class="token punctuation">&gt;</span></span>
</code></pre>
<h2 id="255-&#x542F;&#x52A8;&#x5177;&#x6709;&#x81EA;&#x52A8;&#x5907;&#x707E;&#x529F;&#x80FD;&#x7684;&#x96C6;&#x7FA4;">2.5.5 &#x542F;&#x52A8;&#x5177;&#x6709;&#x81EA;&#x52A8;&#x5907;&#x707E;&#x529F;&#x80FD;&#x7684;&#x96C6;&#x7FA4;</h2>
<h3 id="&#x6B65;&#x9AA4;1-&#x542F;&#x52A8;-zookeeper-&#x670D;&#x52A1;&#x5668;">&#x6B65;&#x9AA4;1: &#x542F;&#x52A8; Zookeeper &#x670D;&#x52A1;&#x5668;</h3>
<p>&#x5206;&#x522B;&#x5728; 3 &#x53F0; Zookeeper &#x670D;&#x52A1;&#x5668;&#x542F;&#x52A8; Zookeeper &#x670D;&#x52A1;</p>
<pre class="language-"><code class="lang-bash">zkServer.sh start
</code></pre>
<p><img src="http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/1539919828.png-atguiguText" alt=""></p>
<h3 id="&#x6B65;&#x9AA4;2-&#x521D;&#x59CB;&#x5316;&#x5728;-zookeeper-&#x4E2D;-ha-&#x7684;&#x72B6;&#x6001;">&#x6B65;&#x9AA4;2: &#x521D;&#x59CB;&#x5316;&#x5728; Zookeeper &#x4E2D; HA &#x7684;&#x72B6;&#x6001;</h3>
<p>&#x5728;&#x4EFB;&#x4F55;&#x4E00;&#x53F0; NameNode &#x4E3B;&#x673A;&#x4E0A;&#x8FD0;&#x884C;&#x4E0B;&#x9762;&#x7684;&#x547D;&#x4EE4;, &#x5C31;&#x53EF;&#x4EE5;&#x521D;&#x59CB;&#x5316;&#x5728; Zookeeper &#x4E2D;&#x9700;&#x8981;&#x7684;&#x72B6;&#x6001;.</p>
<p>&#x5C06;&#x6765;&#x521B;&#x5EFA;&#x4E00;&#x4E2A; znode, &#x81EA;&#x52A8;&#x5907;&#x707E;&#x7CFB;&#x7EDF;&#x4F1A;&#x5728;&#x8FD9;&#x4E2A;&#x8282;&#x70B9;&#x5185;&#x50A8;&#x5B58;&#x6570;&#x636E;.</p>
<pre class="language-"><code class="lang-bash">bin/hdfs zkfc -formatZK
</code></pre>
<p><img src="http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/1539920062.png-atguiguText" alt=""></p>
<p><img src="http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/1539920088.png-atguiguText" alt=""></p>
<h3 id="&#x6B65;&#x9AA4;3-&#x4F7F;&#x7528;-start-dfssh-&#x542F;&#x52A8;&#x96C6;&#x7FA4;">&#x6B65;&#x9AA4;3: &#x4F7F;&#x7528; <code>start-dfs.sh</code> &#x542F;&#x52A8;&#x96C6;&#x7FA4;</h3>
<p>&#x56E0;&#x4E3A;&#x81EA;&#x52A8;&#x5907;&#x707E;&#x5DF2;&#x7ECF;&#x914D;&#x7F6E;&#x5B8C;&#x6210;, <code>start-dfs.sh</code> &#x811A;&#x672C;&#x73B0;&#x5728;&#x5C06;&#x4F1A;&#x81EA;&#x52A8;&#x81EA;&#x52A8;&#x5728;&#x8FD0;&#x884C; NameNode &#x7684;&#x8BBE;&#x5907;&#x4E0A;&#x542F;&#x52A8; ZKFC .</p>
<p>&#x5F53; ZKFC &#x542F;&#x52A8;&#x4E4B;&#x540E;, &#x8FD9;&#x4E9B; ZKFC &#x4F1A;&#x81EA;&#x52A8;&#x7684;&#x9009;&#x62E9;&#x4E00;&#x4E2A; NameNode &#x53D8;&#x6210; Active.</p>
<pre class="language-"><code class="lang-bash">sbin/start-dfs.sh
</code></pre>
<p><img src="http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/1539920502.png-atguiguText" alt=""></p>
<p>&#x73B0;&#x5728;&#x5177;&#x6709;&#x81EA;&#x52A8;&#x5907;&#x707E;&#x7684;&#x96C6;&#x7FA4;&#x5DF2;&#x7ECF;&#x542F;&#x52A8;&#x6210;&#x529F;.</p>
<h3 id="&#x6B65;&#x9AA4;4-&#x9A8C;&#x8BC1;-namenode-&#x7684;&#x81EA;&#x52A8;&#x5907;&#x707E;&#x529F;&#x80FD;">&#x6B65;&#x9AA4;4: &#x9A8C;&#x8BC1; NameNode &#x7684;&#x81EA;&#x52A8;&#x5907;&#x707E;&#x529F;&#x80FD;</h3>
<p>&#x9996;&#x5148;&#x786E;&#x8BA4;&#x4E24;&#x4E2A; NameNode &#x7684;&#x72B6;&#x6001;.</p>
<p><img src="http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/1539920732.png-atguiguText" alt=""></p>
<p>&#x6740;&#x6B7B;&#x6D3B;&#x52A8;&#x7684; NameNode &#x7684;&#x8FDB;&#x7A0B;</p>
<p><img src="http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/1539921037.png-atguiguText" alt=""></p>
<hr>
<h2 id="256-&#x603B;&#x7ED3;">2.5.6 &#x603B;&#x7ED3;</h2>
<p><img src="http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/1539922866.png-atguiguText" alt=""></p>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; &#x5C1A;&#x7845;&#x8C37;&#x5927;&#x6570;&#x636E; &amp; 2019 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification"><br>&#x8BE5;&#x6587;&#x4EF6;&#x6700;&#x540E;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2018-10-19 12:21:32
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="24-ha-hdfs-ji-qun-guan-li-ming-ling.html" class="navigation navigation-prev " aria-label="Previous page: 2.4 HA HDFS 集群管理命令">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="26-wen-da.html" class="navigation navigation-next " aria-label="Next page: 2.6 自动备灾常见问题">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"2.5 自动备灾(Automatic Failover)","level":"1.2.5","depth":2,"next":{"title":"2.6 自动备灾常见问题","level":"1.2.6","depth":2,"path":"chapter1/26-wen-da.md","ref":"chapter1/26-wen-da.md","articles":[]},"previous":{"title":"2.4 HA HDFS 集群管理命令","level":"1.2.4","depth":2,"path":"chapter1/24-ha-hdfs-ji-qun-guan-li-ming-ling.md","ref":"chapter1/24-ha-hdfs-ji-qun-guan-li-ming-ling.md","articles":[]},"dir":"ltr"},"config":{"plugins":["splitter","expandable-chapters-small","page-toc-button","-highlight","prism","prism-themes","tbfed-pagefooter","sitemap","change_girls","livereload"],"styles":{"website":"styles/website.css","ebook":"styles/ebook.css","pdf":"styles/pdf.css","mobi":"styles/mobi.css","epub":"styles/epub.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy 尚硅谷大数据 & 2019","modify_label":"<br>该文件最后修订时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"prism":{"css":["prism-themes/themes/prism-base16-ateliersulphurpool.light.css"]},"disqus":{"shortName":"zhenchao125"},"livereload":{},"splitter":{},"change_girls":{"time":30,"urls":["http://o7cqr8cfk.bkt.clouddn.com/18-3-4/62171757.jpg-atguiguImg","http://o7cqr8cfk.bkt.clouddn.com/18-3-4/83394736.jpg-atguiguImg","http://o7cqr8cfk.bkt.clouddn.com/18-3-4/15906185.jpg-atguiguImg","http://o7cqr8cfk.bkt.clouddn.com/18-3-4/15906185.jpg-atguiguImg","http://o7cqr8cfk.bkt.clouddn.com/18-3-4/3394270.jpg-atguiguImg","http://o7cqr8cfk.bkt.clouddn.com/18-3-4/65028582.jpg-atguiguImg","http://o7cqr8cfk.bkt.clouddn.com/18-3-4/20359261.jpg-atguiguImg","http://o7cqr8cfk.bkt.clouddn.com/18-3-4/37472401.jpg-atguiguImg","http://o7cqr8cfk.bkt.clouddn.com/18-3-4/3355397.jpg-atguiguImg","http://o7cqr8cfk.bkt.clouddn.com/18-3-4/11075549.jpg-atguiguImg"]},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"sitemap":{"hostname":"https://www.gitbook.com/@zhenchao125"},"page-toc-button":{"maxTocDepth":6,"minTocSize":5},"prism-themes":{},"expandable-chapters-small":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":" 李振超","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"大数据 HA 课堂笔记","language":"zh-hans","links":{"sidebar":{"联系我们":"http://www.atguigu.com/"}},"gitbook":"*","description":"课堂笔记,学生提前预习"},"file":{"path":"chapter1/24-zi-dong-bei-707e28-automatic-failover.md","mtime":"2018-10-19T04:21:32.248Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-11-11T09:39:05.323Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-page-toc-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-change_girls/girls.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

